<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set('memory_limit', '1000M');
set_time_limit(0);
CONST TYPE_NORMAL = 1;
CONST TYPE_BAD = 2;
$off_type = 0;
$out = "";
$cnt=0;
while (($line_json = fgets(STDIN)) !== false) {   //line_json=>source_url\tjson��ʽ
    $line_json = trim($line_json);
    if (empty($line_json))
        continue;
    list ($source_url, $list_json) = explode("\t", $line_json);
    $house_info = json_decode($list_json, true);
    $type = trim($type);
    if($lasturl != $house_info['source_url']){
        if($out != "")
	    echo $out;
        $lasturl = $house_info['source_url'];
        $cnt = 1;
        $house_info['cnt'] = $cnt;
        $house_info['repeat_cnt'] = $cnt;
        $out = json_encode($house_info)."\n";
    }
    else{
        $cnt = $cnt + 1;
        $house_info['repeat_cnt'] = $cnt;
	$out = json_encode($house_info)."\n";
    }
}
if($out != "")
    echo $out;
        
  
